package com.lianniu.web.tea.user.register.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lianniu.web.base.BaseResult;
import com.lianniu.web.tea.user.register.dao.FrontusersDao;
import com.lianniu.web.tea.user.register.model.Frontusers;
import com.lianniu.web.tea.user.register.service.ITeaUserRegisterService;

@Service
@Transactional
public class TeaUserRegisterServiceImpl implements ITeaUserRegisterService {

	@Autowired
	private FrontusersDao frontusersDao;
	
	@Override
	public BaseResult registerWeixin(String openid,String username,String picpath) {
		Frontusers front = frontusersDao.selectByOpenid(openid);
		if(front==null) {
			front = new Frontusers();
			front.setWeixin(openid);
			front.setUsersname(username);
			front.setPicpath(picpath);
			frontusersDao.insert(front);
		}
		return BaseResult.success(front);
	}

	
}
